package org.jcb.compter.view;



import org.jcb.compter.R;
import org.jcb.compter.model.BasicData;
import org.jcb.compter.model.User;
import org.jcb.compter.presenter.CountPresenter;

import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

public class LearnView extends LinearLayout{
	private Button  buttonPrev, buttonFirst, buttonNext, buttonRepeteSon ;  
	BasicData currentData ;	
	final CountPresenter presenter ;
	TextView textLearnNumber ;
	//ChinoisActivity chinoisActivity ;
	
	public LearnView(Context context, final CountPresenter presenter, User user ) {
		super(context);
		this.presenter = presenter ;
		LayoutInflater layoutInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View view=layoutInflater.inflate(R.layout.learnview,this);		
		   buttonPrev  = (Button) view.findViewById(R.id.btnlearnPrev);
		   buttonFirst  = (Button) view.findViewById(R.id.btnlearnFirst);
	       buttonRepeteSon = (Button) view.findViewById(R.id.btnlearnRepeat);
	       buttonNext		= (Button) view.findViewById(R.id.btnlearnNext);		
	       textLearnNumber = (TextView) view.findViewById(R.id.textLearnNumber);
	       currentData = presenter.firstItem() ;
		
		buttonNext.setOnClickListener(new View.OnClickListener() {
	           public void onClick(View v) {
	               Log.d("TAG", "mAddAccountButton clicked");
	               currentData = presenter.nextItem(currentData);
	               display(currentData);
	           }
	       });		
	}
	
	
	public void display(BasicData currentData) {
		textLearnNumber.setText(currentData.getLibLangRef());
//		tvChineseChar.setText(currentData.getCarCompose());
//		tvPinyin.setText(currentData.getPinyin() );
//		tvTranslated.setText(currentData.getCarComposeTraduit());
//		if (currentData.getAdrImgage() != null) {
//			imageCharacter.setImageResource(Integer.parseInt(currentData.getAdrImgage()));
//		}
//		else {
//			imageCharacter.setImageResource(R.drawable.interrogation);
//		}                                   vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg_____________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________èèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèèè&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&àààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààààaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
//			ChinoisActivity.mediaPlayer = MediaPlayer.create(this.getContext(), sound);
//			ChinoisActivity.mediaPlayer.start();
//		}
	}
	

}
